package com.atguigu.spzx.service.user.controller;

import com.atguigu.spzx.service.user.service.RegionService;
import com.atguigu.spzx.model.common.Result;
import com.atguigu.spzx.model.entity.region.Region;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * title:
 * author: zgl
 * date: 2024/1/18
 * description：
 */
@RestController
@RequestMapping("/api/user/region")
public class RegionController {
    @Resource
    private RegionService regionService;
    @Operation(summary = "获取地区信息接口")
    @GetMapping("/findByParentCode/{parentCode}")
    public Result findByParentCode(@PathVariable String parentCode){
        List<Region> regionList = regionService.findByParentCode(parentCode);
        return Result.ok(regionList);
    }
}
